package com.trailer.lookimg.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import com.trailer.lookimg.fragment.ImageDetailFragment
import com.trailer.base.utils.B
import java.util.*


/**
 *
 *on 2020/9/18
 */
class ImagePagerAdapter(val fm: FragmentManager,val urls: ArrayList<String>) : FragmentStatePagerAdapter(fm){

    override fun getItem(position: Int): Fragment {
        val url = urls[position]

        val fragment = ImageDetailFragment()
         fragment.arguments = B.with()
                .putString("url", url)
                .ok()
        return fragment
    }

    override fun getCount(): Int {
        return urls.size
    }
}
